package satir.record.factory;

import org.json.JSONObject;
import satir.framework.refectoring.Factory;
import satir.record.Profile;

/**
 * A factory for creating Profile object.
 * @version 3.0 April 2012
 * @author Creative Family
 */
public class ProfileFactory implements Factory {

    /**
     * Creates the profile.
     * @param json
     *            the JSON
     * @return the object
     * @see Factory, LazyInitiator
     */
    @Override
    public Object create(final JSONObject json) {
        try {
            String playerName = json.getString("key");
            Profile instantiation = new Profile(playerName);
            return instantiation;
        } catch (Exception e) {
	    e.printStackTrace();
	}
	return null;
    }
}
